#include "stdafx.h"
#include "labeling_tetra-wrap.h"
#include "labeling_tetra-impl.h"


#define LABELING_MATELIALIZE(_Ts, _Tl, NAME)                                  \
                                                                              \
NAME::NAME(size_t label_size_estimate, int limit_type, int limit)             \
{                                                                             \
  labeling = new Labeling<_Ts, _Tl>(label_size_estimate, limit_type, limit);  \
}                                                                             \
                                                                              \
NAME::~NAME() {delete labeling;}                                              \
                                                                              \
void NAME::Exec(const source_mat &src){return labeling->Exec(src);}           \
void NAME::Exec(const source_mat &src, label_mat &dst) {                      \
  return labeling->Exec(src, dst);                                            \
};                                                                            \
                                                                              \
void NAME::setLimit(int limit_type, int limit) {                              \
  labeling->SetLimit(limit_type, limit);                                      \
}                                                                             \
                                                                              \
const NAME::RegionInfoVec NAME::getRegions() {                                \
  return labeling->GetRegions();                                              \
}                                                                             \

namespace cv{
namespace Labeling{
LABELING_MATELIALIZE(uint8_t,  uint8_t,  LabelingBB);
LABELING_MATELIALIZE(uint8_t,  uint16_t, LabelingBS);
LABELING_MATELIALIZE(uint8_t,  uint32_t, LabelingBL);
LABELING_MATELIALIZE(uint16_t, uint8_t,  LabelingSS);
LABELING_MATELIALIZE(uint16_t, uint16_t, LabelingSB);
LABELING_MATELIALIZE(uint16_t, uint32_t, LabelingSL);
LABELING_MATELIALIZE(uint32_t, uint8_t,  LabelingLS);
LABELING_MATELIALIZE(uint32_t, uint16_t, LabelingLB);
LABELING_MATELIALIZE(uint32_t, uint32_t, LabelingLL);
}
}

#undef LABELING_MATELIALIZE